export default {
  // 保存首页介绍分类信息
  getHomeListData(state, payload) {
    state.homeListData = payload;
  },
  // 保存用户在线阅读过的书籍
  getUserOnlineHistry(state, payload) {
    state.userOnlineHistry = payload;
  },
  // 保存轮播图数据
  getDetailsNavigation(state, payload) {
    state.detailsNavigation = payload;
  },
  // 保存书籍分页查询后的数据
  getMobiBooks(state, payload) {
    state.mobiBooks = payload;
    // 将书籍信息保存在本地,作为推荐书籍
    localStorage.setItem('mobiBooks', JSON.stringify(state.mobiBooks));
  },
  // 保存书籍的总数
  getMobiBooksTotal(state, payload) {
    state.mobiBooksTotal = payload.length;
  },
  // 保存当前Id获取的书籍数据
  getMobiBooksList(state, payload) {
    state.mobiBookList = payload;
  },
  // 保存用户登录信息
  getUserData(state, payload){
    state.userState = payload;
  },
  // 保存用户注册是否成功的状态字符
  upLoadUserData(state, payload){
    state.userUpLoad= payload;
  },
  // 将用户名称和路由路径重定向
  getChangeURL(state) {
    state.loginState = JSON.parse(localStorage.getItem('userInformation')).username;
    state.loginPath = '/userCenter';
  },
  // 保存用户自身修改后的状态字符
  setUserData(state, payload) {
    state.setUserData = payload;
  },
  // 更新当前用户信息
  getChangeUserData(state, payload) {
    state.getChangeUserData = payload[0];
  },
  // 保存当前请求的天气
  getWeather(state, payload) {
    state.getWeather = payload;
  },
  // 保存当前日期时间
  nowDateUpWeather(state, payload) {
    state.nowDateUpWeather = payload;
  },
  // 保存用户数据渲染到表格
  getUserTable(state, payload) {
    state.getUserTable = payload;
  },
  // 保存书籍数据渲染到表格
  getBooksTable(state, payload) {
    state.getBooksTable = payload;
  },
  // 保存用户评论数据渲染到表格
  getCommentsTable(state, payload) {
    state.getCommentsTable = payload;
  },
  // 保存修改用户管理员权限的状态字符
  changeRoot(state, payload) {
    state.changeRoot = payload;
  },
  // 保存用户评论
  getUserComment(state, payload) {
    state.userComment = payload;
  },
  // 保存书籍搜索数据
  getSearchBooks(state, payload) {
    state.getSearchBooks = payload;
  },
  // 清空书籍搜索框
  clearSearchBooks(state) {
    state.getSearchBooks = '';
  },
  // 请求的在线阅读书籍
  readBooks(state, payload) {
    state.readBooks = payload;
  }
}